package org.yohann.ai.tool;

import lombok.AllArgsConstructor;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.yohann.ai.annotation.Tools;
import org.yohann.ai.service.ReplyEmailService;
import org.yohann.ai.tool.base.BaseTools;

import java.util.List;

@Tools
@AllArgsConstructor
public class ReplyEmailTools implements BaseTools {

    private final ReplyEmailService service;

    @Tool(description = "获取邮件需求问题分类")
    public List<String> getAllEmailType() {
        return service.getAllEmailType();
    }

    @Tool(description = "获取邮件回复模板")
    public String getEmailTemplate(@ToolParam(description = "问题分类") String emailType) {
        return service.getEmailTemplate(emailType);
    }

    @Tool(description = "回复用户邮件")
    public String replyEmail(@ToolParam(description = "邮箱") String email, @ToolParam(description = "回复内容") String content) {
        service.replyEmail(email, content);
        return "reply success";
    }

    @Tool(description = "创建未知客户投诉工单")
    public String createTicket(@ToolParam(description = "投诉内容") String content) {
        service.createTicket(null, content);
        return "create success";
    }

    @Tool(description = "创建客户投诉工单")
    public String createTicketForUser(@ToolParam(description = "用户ID") String userId, @ToolParam(description = "投诉内容") String content) {
        service.createTicket(userId, content);
        return "create success";
    }
}
